package com.ruoyi.system.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.system.service.IGeoLocationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;

/**
 * 地理位置信息Controller
 * 
 * @author ruoyi
 * @date 2024-01-01
 */
@Tag(name = "地理位置管理", description = "地理位置相关接口")
@RestController
@RequestMapping("/system/geo")
public class GeoLocationController extends BaseController
{
    @Autowired
    private IGeoLocationService geoLocationService;

    /**
     * 根据地址获取经纬度
     */
    @Operation(summary = "根据地址获取经纬度", description = "通过地址查询对应的经纬度坐标")
    @Log(title = "地理位置", businessType = BusinessType.OTHER)
    @GetMapping("/addressToLocation")
    public AjaxResult getLocationByAddress(
            @Parameter(description = "地址", required = true)
            @RequestParam String address)
    {
        return geoLocationService.getLocationByAddress(address);
    }
    
}
